home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 90 / CDMM_90_1.ISO / Industry Giant 2 / ig2_setup_demo.exe / 00_00_TUTORIAL 1_1900.TXT < prev    next >
Encoding:
Text File  |  2002-05-23  |  19.9 KB  |  875 lines

  1. // ============================================================================
  2. // TUTORIAL 1
  3. // 
  4. // The script implements tutorial nr 1.
  5. //
  6. // Topic :
  7. //     - Basic navigation
  8. //    - Building basic production
  9. // ============================================================================
  10.  
  11. // ============================================================================
  12. // VARIABLES
  13. // ============================================================================
  14.  
  15. [VARIABLES]
  16.  
  17.     // Parameter variables.
  18.     ReturnState$
  19.     FirstTutorialTextID
  20.     LastTutorialTextID
  21.     TutorialTextID
  22.  
  23.     // Global variables.
  24.     LastBuildingTime
  25.     LastEvaluationTime
  26.     Shop_X
  27.     Shop_Y
  28.     ShopID
  29.     Farm_X
  30.     Farm_Y
  31.     FarmID
  32.     StoragePlace_X
  33.     StoragePlace_Y
  34.     StoragePlaceID
  35.  
  36.     // Local temporary variables.
  37.     Local_i
  38.     Local_j
  39.     temp
  40.  
  41.  
  42. // ============================================================================
  43. // INIT
  44. // ============================================================================
  45. [STATE Load]
  46.  
  47.     LoadGame("missions\\00_00_Tutorial 1_1900.ig2")
  48.     LoadMissionConfig("missions\\00_00_Tutorial 1_1900.mis")
  49.     SetOutputMode(2)
  50.     SetMsgFilter(65535)
  51.     StartCommandFiltering()
  52.     ControlBar.SetDisable(871)
  53.     DialogControl.SetDisable(22)
  54.     SetState("Explain_Scrolling")
  55.  
  56.  
  57. // ============================================================================
  58. // EXPLANATION : RECALL NEWS
  59. // ============================================================================
  60. [STATE Explain_News]
  61.     TutorialTextID = 203
  62.     ReturnState = 'Wait_for_news_list'
  63.     SetState("Show_tutorial_text")
  64.  
  65. [STATE Wait_for_news_list]
  66.     IF NewsDialog.IsOpen() == 1
  67.     THEN
  68.         SetState("Wait_for_news_close")
  69.     END
  70.  
  71. [STATE Wait_for_news_close]
  72.     IF NewsDialog.IsOpen() == 0
  73.     THEN
  74.         SetState("Start_build_shop")
  75.     END
  76.  
  77.  
  78. // ============================================================================
  79. // EXPLANATION : BASIC NAVIGATION
  80. // ============================================================================
  81. [STATE Explain_Scrolling]
  82.     FirstTutorialTextID = 200
  83.     LastTutorialTextID  = 201
  84.     ReturnState = 'Wait_Scroll'
  85.     SetState("Show_tutorial_text_serie")
  86.  
  87. [STATE Wait_Scroll]
  88.     IF IsEnterState
  89.     THEN
  90.         Local_i = GetMapOriginY()
  91.         Local_j = GetMapOriginX()
  92.     ELSE
  93.         IF Local_i <> GetMapOriginY() OR
  94.             Local_j <> GetMapOriginX()
  95.         THEN
  96.             SetState("Wait_Not_Scroll")
  97.         END
  98.     END
  99.  
  100. [STATE Wait_Not_Scroll]
  101.     IF IsEnterState
  102.     THEN
  103.         temp = Time.ms
  104.         Local_i = GetMapOriginY()
  105.         Local_j = GetMapOriginX()
  106.     ELSE
  107.         IF Local_i <> GetMapOriginY() OR
  108.             Local_j <> GetMapOriginX()
  109.         THEN
  110.             // Still scrolling ...
  111.             Local_i = GetMapOriginY()
  112.             Local_j = GetMapOriginX()
  113.             temp = Time.ms
  114.         ELSE
  115.             IF temp + 200 < Time.ms
  116.             THEN
  117.                 SetState("Explain_Minimap")
  118.             END
  119.         END
  120.     END
  121.  
  122. [STATE Explain_Zoom]
  123.     TutorialTextID    = 260
  124.     ReturnState        = 'Explain_Minimap'
  125.     SetState("Show_tutorial_text")
  126.  
  127. [STATE Explain_Minimap]
  128.     TutorialTextID    = 202
  129.     ReturnState        = 'Wait_for_Minimap'
  130.     SetState("Show_tutorial_text")
  131.  
  132. [STATE Wait_for_Minimap]
  133.     IF IsDialogOpen("MiniMap_S_Dlg.uif") OR
  134.         IsDialogOpen("MiniMap_L_Dlg.uif")
  135.     THEN 
  136.         SetState("Explain_News")
  137.     END
  138.  
  139.  
  140. // ============================================================================
  141. // EXPLANATION : HOW TO BUILD
  142. // ============================================================================
  143. [STATE Explain_how_to_build]
  144.     CenterUserViewTo(68, 83)
  145.     FirstTutorialTextID        = 205
  146.     LastTutorialTextID        = 207
  147.     ReturnState        = 'Start_build_shop'
  148.     SetState("Show_tutorial_text_serie")
  149.  
  150.  
  151. // ============================================================================
  152. // EXPLANATION : BUILD SHOP
  153. // ============================================================================
  154. [STATE Start_build_shop]
  155.     CenterUserViewTo(68, 83)
  156.     FirstTutorialTextID        = 205
  157.     LastTutorialTextID        = 207
  158.     ReturnState        = 'Wait_build_menu'
  159.     SetState("Show_tutorial_text_serie")
  160.  
  161. [STATE Explain_categories]
  162.     IF BuildDialog.IsOpen()
  163.     THEN 
  164.         FirstTutorialTextID        = 206
  165.         LastTutorialTextID        = 207
  166.         ReturnState        = 'Wait_shop_placing'
  167.         SetState("Show_tutorial_text_serie")
  168.     END
  169.  
  170. [STATE Wait_build_menu]
  171.  
  172.     IF BuildDialog.IsOpen()
  173.     THEN 
  174.         IF BuildDialog.GetPanelID() <> 3
  175.         THEN
  176.             FirstTutorialTextID        = 208
  177.             LastTutorialTextID        = 209
  178.             ReturnState        = 'Wait_shop_panel'
  179.             SetState("Show_tutorial_text_serie")
  180.         ELSE
  181.             SetState("Wait_shop_panel")
  182.         END
  183.     END
  184.  
  185. [STATE Wait_shop_panel]
  186.  
  187.     IF BuildDialog.GetPanelID() == 3
  188.     THEN
  189.         ClearCommandQueue()
  190.  
  191.         FirstTutorialTextID        = 210
  192.         LastTutorialTextID        = 213
  193.         ReturnState        = 'Wait_shop_placing'
  194.         SetState("Show_tutorial_text_serie")
  195.     ELSE    
  196.         IF BuildDialog.IsOpen() == 0
  197.         THEN             
  198.             SetState("Start_build_shop")
  199.         END
  200.     END
  201.  
  202. [STATE Wait_shop_selection]
  203.  
  204.     IF BuildDialog.GetSelectionID() == 7
  205.     THEN 
  206.         ClearCommandQueue()
  207.         FirstTutorialTextID        = 209
  208.         LastTutorialTextID        = 211
  209.         ReturnState        = 'Wait_shop_placing'
  210.         SetState("Show_tutorial_text_serie")
  211.  
  212.     ELSE
  213.         IF BuildDialog.IsOpen() == 0                
  214.         THEN             
  215.             SetState("Start_build_shop")
  216.         ELSE
  217.             IF BuildDialog.GetPanelID() <> 3                
  218.             THEN             
  219.                 FirstTutorialTextID        = 206
  220.                 LastTutorialTextID        = 207
  221.                 ReturnState        = 'Wait_shop_panel'
  222.                 SetState("Show_tutorial_text_serie")
  223.             END
  224.         END
  225.     END
  226.  
  227. [STATE Wait_shop_placing]
  228.  
  229.     // Is there a queued command ? 
  230.     IF GetCommandQueueLength() > 0
  231.     THEN
  232.         IF NextCommand.GetType() == 8 AND
  233.             NextCommand.GetInternType() == 7
  234.         THEN    
  235.             SetState("Verify_shop_location")
  236.         ELSE
  237.             NextCommand.Cancel()
  238.             ClearCommandQueue()
  239.             TutorialTextID    = 207
  240.             ReturnState        = 'Wait_shop_placing'
  241.             SetState("Show_tutorial_text")
  242.         END
  243.     ELSE
  244.         // Is the build menu closed ? 
  245.         IF BuildDialog.IsOpen() == 0
  246.         THEN 
  247.             // Ask the user to open it.
  248.             SetState("Start_build_shop")
  249.         ELSE
  250.             IF BuildDialog.GetPanelID() <> 3
  251.             THEN
  252.                 TutorialTextID        = 209
  253.                 ReturnState        = 'Wait_shop_panel'
  254.                 SetState("Show_tutorial_text")
  255.             END
  256.         END
  257.     END
  258.  
  259. [STATE Verify_shop_location]
  260.     
  261.     // Fetch the building coordinates.
  262.     Shop_X = NextCommand.GetX()
  263.     Shop_Y = NextCommand.GetY()
  264.  
  265.     // Is it near enough ?
  266.     IF abs(Shop_X - 69) < 10 AND 
  267.         abs(Shop_Y - 86) < 10
  268.     THEN
  269.         NextCommand.Run()
  270.         ShopID = User.GetLastBuildingBuilt()
  271.         ClearCommandQueue()
  272.         SetState("Start_build_storage_place")
  273.     ELSE
  274.         NextCommand.Cancel()
  275.         ClearCommandQueue()
  276.         TutorialTextID    = 104
  277.         ReturnState        = 'Wait_shop_placing'
  278.         SetState("Show_tutorial_text")
  279.     END
  280.  
  281.  
  282. // ============================================================================
  283. // EXPLANATION : BUILD STORAGE PLACE
  284. // ============================================================================
  285.  
  286. [STATE Start_build_storage_place]
  287.     FirstTutorialTextID        = 216
  288.     LastTutorialTextID        = 218
  289.     ReturnState        = 'Wait_storage_place_placement'
  290.     SetState("Show_tutorial_text_serie")
  291.  
  292. [STATE Wait_storage_place_selection]
  293.  
  294.     IF BuildDialog.IsOpen() == 1
  295.     THEN 
  296.         IF BuildDialog.GetPanelID() == 2
  297.         THEN
  298.             IF BuildDialog.GetSelectionID() == 1
  299.             THEN
  300.                 ClearCommandQueue() 
  301.                 TutorialTextID    = 223
  302.                 ReturnState        = 'Wait_storage_place_placement'
  303.                 SetState("Show_tutorial_text")
  304.             END
  305.         END
  306.     END
  307.  
  308. [STATE Wait_storage_place_placement]
  309.  
  310.     // Is there a queued command ? 
  311.     IF GetCommandQueueLength() > 0
  312.     THEN
  313.         IF NextCommand.GetType() == 7
  314.         THEN    
  315.             SetState("Verify_Storage_place_location")
  316.         ELSE
  317.             NextCommand.Cancel()
  318.             ClearCommandQueue()
  319.             SetState("Start_build_storage_place")
  320.         END
  321.     END
  322.  
  323. [STATE Verify_Storage_place_location]
  324.     // Check are both farm and shop highlighted
  325.     IF IsHighlighted(ShopID)
  326.     THEN
  327.         NextCommand.Run()
  328.         StoragePlaceID = User.GetLastBuildingBuilt()
  329.         ClearCommandQueue()
  330.         SetState("Start_build_hen_farm")
  331.     ELSE
  332.         NextCommand.Cancel()
  333.         ClearCommandQueue()
  334.         TutorialTextID    = 218
  335.         ReturnState        = 'Wait_storage_place_placement'
  336.         SetState("Show_tutorial_text")
  337.     END
  338.  
  339.  
  340.  
  341. // ============================================================================
  342. // EXPLANATION : BUILD HEN FARM
  343. // ============================================================================
  344.  
  345. [STATE Start_build_hen_farm]
  346.  
  347.     TutorialTextID    = 221
  348.     ReturnState        = 'Wait_farm_selection'
  349.     SetState("Show_tutorial_text")
  350.  
  351. [STATE Wait_farm_selection]
  352.  
  353.     ClearCommandQueue()
  354.  
  355.     IF BuildDialog.IsOpen() == 1
  356.     THEN 
  357.         IF BuildDialog.GetPanelID() == 1
  358.         THEN
  359.             IF BuildDialog.GetSelectionID() == 6
  360.             THEN
  361.                 TutorialTextID    = 224
  362.                 ReturnState        = 'Wait_farm_placement'
  363.                 SetState("Show_tutorial_text")
  364.             END
  365.         END
  366.     END
  367.  
  368. [STATE Wait_farm_placement]
  369.     
  370.     // Is there a queued command ? 
  371.     IF GetCommandQueueLength() > 0
  372.     THEN
  373.         IF NextCommand.GetType() == 4
  374.         THEN    
  375.             SetState("Verify_farm_location")
  376.         ELSE
  377.             NextCommand.Cancel()
  378.             ClearCommandQueue()
  379.             TutorialTextID    = 122
  380.             ReturnState        = 'Wait_farm_placement'
  381.             SetState("Show_tutorial_text")
  382.         END
  383.     ELSE
  384.         IF BuildDialog.IsOpen() == 0
  385.         THEN 
  386.             SetState("Start_build_hen_farm")
  387.         ELSE
  388.             IF BuildDialog.GetPanelID() <> 1
  389.             THEN
  390.                 SetState("Start_build_hen_farm")
  391.             ELSE
  392.                 IF BuildDialog.GetSelectionID() <> 6
  393.                 THEN
  394.                     SetState("Start_build_hen_farm")                   
  395.                 END
  396.             END
  397.         END
  398.     END
  399.  
  400. [STATE Verify_farm_location]
  401.     
  402.     // Fetch the building coordinates.
  403.     Farm_X = NextCommand.GetX()
  404.     Farm_Y = NextCommand.GetY()
  405.  
  406.     // Is it near enough ?
  407.     IF IsHighlighted(StoragePlaceID)
  408.     THEN
  409.         NextCommand.Run()
  410.         FarmID = User.GetLastBuildingBuilt()
  411.         ClearCommandQueue()
  412.         SetState("Start_set_production")
  413.     ELSE
  414.         NextCommand.Cancel()
  415.         ClearCommandQueue()
  416.         TutorialTextID    = 224
  417.         ReturnState        = 'Wait_farm_placement'
  418.         SetState("Show_tutorial_text")
  419.     END
  420.  
  421.  
  422. // ============================================================================
  423. // EXPLANATION : SET PRODUCTION
  424. // ============================================================================
  425.  
  426. [STATE Closing_build_menu]
  427.  
  428.     ClearCommandQueue()
  429.     TutorialTextID    = 227
  430.     ReturnState        = 'Wait_for_menu_closing'
  431.     SetState("Show_tutorial_text")
  432.  
  433. [STATE Wait_for_menu_closing]
  434.     
  435.     IF BuildDialog.IsOpen() == 0
  436.     THEN
  437.         SetState("Start_set_production")
  438.     END
  439.  
  440. [STATE Start_set_production]
  441.     FirstTutorialTextID        = 230
  442.     LastTutorialTextID        = 231
  443.     ReturnState        = 'Wait_for_production_menu'
  444.     SetState("Show_tutorial_text_serie")
  445.  
  446. [STATE Wait_for_production_menu]
  447.     
  448.     IF ProductionDialog.IsOpen() == 1
  449.     THEN
  450.         TutorialTextID    = 234
  451.         ReturnState        = 'Wait_for_product_selection'
  452.         SetState("Show_tutorial_text")
  453.     END
  454.  
  455. [STATE Wait_for_product_selection]
  456.  
  457.     IF ProductionDialog.GetProduct() == 18
  458.     THEN
  459.         TutorialTextID    = 237
  460.         ReturnState        = 'Wait_for_load'
  461.         SetState("Show_tutorial_text")
  462.     END
  463.  
  464.     IF ProductionDialog.IsOpen() == 0
  465.     THEN
  466.         SetState("Start_set_production")
  467.     END
  468.  
  469.  
  470. [STATE Wait_for_load]
  471.     IF ProductionDialog.GetLoad() == 50
  472.     THEN
  473.         ClearCommandQueue()
  474.         TutorialTextID = 240
  475.         ReturnState        = 'Wait_for_set_production'
  476.         SetState("Show_tutorial_text")
  477.     END
  478.  
  479.     IF ProductionDialog.IsOpen() == 0
  480.     THEN
  481.         SetState("Start_set_production")
  482.     END
  483.  
  484.  
  485. [STATE Wait_for_set_production]
  486.  
  487.     // Is there a queued command ? 
  488.     IF GetCommandQueueLength() > 0
  489.     THEN
  490.         IF NextCommand.GetType() == 14
  491.         THEN    
  492.             SetState("Verify_farm_production")
  493.         ELSE
  494.             NextCommand.Cancel()
  495.             ClearCommandQueue()
  496.             TutorialTextID    = 142
  497.             ReturnState        = 'Wait_for_production_menu'
  498.             SetState("Show_tutorial_text")
  499.         END
  500.     ELSE
  501.         IF ProductionDialog.IsOpen() == 0
  502.         THEN
  503.             SetState("Start_set_production")
  504.         END
  505.     END
  506.     
  507. [STATE Verify_farm_production]
  508.     
  509.     // Is it eggs ?
  510.     IF NextCommand.GetInternType() == 18 AND
  511.         NextCommand.GetInternType2() == 0.50
  512.     THEN
  513.         NextCommand.Run()
  514.         ClearCommandQueue()
  515.         SetState("Wait_month_change")
  516.     ELSE
  517.         NextCommand.Cancel()
  518.         ClearCommandQueue()
  519.         SetState("Start_set_production")
  520.     END
  521.  
  522.  
  523. // ============================================================================
  524. // EXPLANATION : SHOP DIALOG
  525. // ============================================================================
  526. [STATE Wait_month_change]
  527.     IF IsEnterState
  528.     THEN
  529.         Time.SetPace(10)
  530.     END
  531.     
  532.     IF User.GetIncome() > 0
  533.     THEN
  534.         Time.SetPace(0.25)
  535.         SetState("Start_explain_shop_dlg")
  536.     END
  537.  
  538. [STATE Start_explain_shop_dlg]
  539.  
  540.     FirstTutorialTextID        = 243
  541.     LastTutorialTextID        = 245
  542.     ReturnState        = 'Wait_for_shop_dlg'
  543.     SetState("Show_tutorial_text_serie")
  544.  
  545. [STATE Wait_for_shop_dlg]
  546.     
  547.     IF ShopDialog.IsOpen() == 1
  548.     THEN
  549.         TutorialTextID    = 248
  550.         ReturnState        = 'Wait_for_eggs'
  551.         SetState("Show_tutorial_text")
  552.     END
  553.  
  554. [STATE Wait_for_eggs]
  555.     
  556.     IF ShopDialog.IsOpen() == 0
  557.     THEN
  558.         SetState("Start_explain_shop_dlg")
  559.     END
  560.  
  561.     IF ShopDialog.GetProduct() == 18
  562.     THEN
  563.         FirstTutorialTextID        = 251
  564.         LastTutorialTextID        = 252
  565.         ReturnState        = 'Wait_for_demand_supply'
  566.         SetState("Show_tutorial_text_serie")
  567.     END
  568.  
  569. [STATE Wait_for_demand_supply]
  570.  
  571.     IF ShopDialog.IsOpen() == 0
  572.     THEN
  573.         SetState("Start_explain_shop_dlg")
  574.     END
  575.  
  576.     IF ShopDialog.GetButtonPressed() == 2
  577.     THEN
  578.         SetState("Explain_mission_goal")
  579.     END
  580.  
  581. [STATE Wait_for_product_profit]    
  582.  
  583.     IF ShopDialog.IsOpen() == 0
  584.     THEN
  585.         SetState("Start_explain_shop_dlg")
  586.     END
  587.  
  588.     IF ShopDialog.GetProduct() <> 18
  589.     THEN
  590.          TutorialTextID    = 231
  591.         ReturnState        = 'Wait_for_eggs'
  592.         SetState("Show_tutorial_text")       
  593.     END
  594.  
  595.     IF ShopDialog.GetButtonPressed() == 1
  596.     THEN
  597.         TutorialTextID    = 234
  598.         ReturnState        = 'Wait_for_product_sales'
  599.         SetState("Show_tutorial_text")
  600.     END
  601.  
  602. [STATE Wait_for_product_sales]    
  603.  
  604.     IF ShopDialog.IsOpen() == 0
  605.     THEN
  606.         SetState("Start_explain_shop_dlg")
  607.     END
  608.  
  609.     IF ShopDialog.GetProduct() <> 18
  610.     THEN
  611.          TutorialTextID    = 231
  612.         ReturnState        = 'Wait_for_eggs'
  613.         SetState("Show_tutorial_text")       
  614.     END
  615.  
  616.     IF ShopDialog.GetButtonPressed() == 0
  617.     THEN
  618.         TutorialTextID    = 235
  619.         ReturnState        = 'Go_back_to_demandsupply'
  620.         SetState("Show_tutorial_text")
  621.     END
  622.  
  623. [STATE Go_back_to_demandsupply]    
  624.  
  625.     IF ShopDialog.IsOpen() == 0
  626.     THEN
  627.         SetState("Start_explain_shop_dlg")
  628.     END
  629.  
  630.     IF ShopDialog.GetProduct() <> 18
  631.     THEN
  632.          TutorialTextID    = 231
  633.         ReturnState        = 'Wait_for_eggs'
  634.         SetState("Show_tutorial_text")       
  635.     END
  636.  
  637.     IF ShopDialog.GetButtonPressed() == 2
  638.     THEN
  639.         TutorialTextID    = 236
  640.         ReturnState        = 'Change_price_to_60'
  641.         SetState("Show_tutorial_text")
  642.     END
  643.  
  644. [STATE Change_price_to_60]    
  645.  
  646.     IF ShopDialog.IsOpen() == 0
  647.     THEN
  648.         SetState("Start_explain_shop_dlg")
  649.     END
  650.  
  651.     IF ShopDialog.GetProduct() <> 18
  652.     THEN
  653.          TutorialTextID    = 231
  654.         ReturnState        = 'Wait_for_eggs'
  655.         SetState("Show_tutorial_text")       
  656.     END
  657.  
  658.     IF ShopDialog.GetPrice() == 0.60
  659.     THEN
  660.         TutorialTextID    = 237
  661.         ReturnState        = 'Wait_for_dialog_accept'
  662.         SetState("Show_tutorial_text")
  663.     END
  664.  
  665. [STATE Wait_for_dialog_accept]
  666.  
  667.     // Is there a queued command ? 
  668.     IF GetCommandQueueLength() > 0
  669.     THEN
  670.         IF NextCommand.GetType() == 33
  671.             AND ChangeStore.GetPrice(18) == 0.60
  672.         THEN    
  673.             NextCommand.Run()
  674.             ClearCommandQueue()
  675.             SetState("Wait_month_change_2")
  676.         ELSE
  677.             NextCommand.Cancel()
  678.             ClearCommandQueue()
  679.             SetState("Start_explain_shop_dlg")
  680.         END
  681.     ELSE
  682.         IF ShopDialog.IsOpen() == 0
  683.         THEN
  684.             SetState("Start_explain_shop_dlg")
  685.         END
  686.     END
  687.  
  688. [STATE Wait_month_change_2]
  689.     IF IsEnterState
  690.     THEN
  691.         temp = Time.Month
  692.         Time.SetPace(10)
  693.     END
  694.     
  695.     IF temp <> Time.Month
  696.     THEN
  697.         Time.SetPace(1)
  698.         SetState("Start_explain_shop_dlg_2")
  699.     END
  700.  
  701. [STATE Start_explain_shop_dlg_2]
  702.  
  703.     TutorialTextID    = 215
  704.     ReturnState        = 'Wait_for_shop_dlg_2'
  705.     SetState("Show_tutorial_text")
  706.  
  707. [STATE Wait_for_shop_dlg_2]
  708.     
  709.     IF ShopDialog.IsOpen() == 1
  710.     THEN
  711.         SetState("Explain_mission_goal")
  712.     END
  713.  
  714. [STATE Wait_for_product_profit_2]    
  715.  
  716.     IF ShopDialog.IsOpen() == 0
  717.     THEN
  718.         SetState("Start_explain_shop_dlg_2")
  719.     END
  720.  
  721.     IF ShopDialog.GetButtonPressed() == 1
  722.     THEN
  723.         TutorialTextID    = 240
  724.         ReturnState        = 'Wait_for_product_sales_2'
  725.         SetState("Show_tutorial_text")
  726.     END
  727.  
  728. [STATE Wait_for_product_sales_2]    
  729.  
  730.     IF ShopDialog.IsOpen() == 0
  731.     THEN
  732.         SetState("Start_explain_shop_dlg_2")
  733.     END
  734.  
  735.     IF ShopDialog.GetButtonPressed() == 0
  736.     THEN
  737.         TutorialTextID    = 241
  738.         ReturnState        = 'Change_price_to_100'
  739.         SetState("Show_tutorial_text")
  740.     END
  741.  
  742. [STATE Change_price_to_100]    
  743.  
  744.     IF ShopDialog.IsOpen() == 0
  745.     THEN
  746.         SetState("Start_explain_shop_dlg_2")
  747.     END
  748.  
  749.     IF ShopDialog.GetPrice() == 1.0
  750.     THEN
  751.         TutorialTextID    = 242
  752.         ReturnState        = 'Wait_for_dialog_accept_2'
  753.         SetState("Show_tutorial_text")
  754.     END
  755.  
  756. [STATE Wait_for_dialog_accept_2]
  757.  
  758.     // Is there a queued command ? 
  759.     IF GetCommandQueueLength() > 0
  760.     THEN
  761.         IF NextCommand.GetType() == 33
  762.         THEN    
  763.             NextCommand.Run()
  764.             ClearCommandQueue()
  765.             SetState("Explain_mission_goal")
  766.         ELSE
  767.             NextCommand.Cancel()
  768.             ClearCommandQueue()
  769.             TutorialTextID    = 242
  770.             ReturnState        = 'Wait_for_dialog_accept_2'
  771.             SetState("Show_tutorial_text")
  772.         END
  773.     ELSE
  774.         IF ShopDialog.IsOpen() == 0
  775.         THEN
  776.             SetState("Start_explain_shop_dlg_2")
  777.         END
  778.     END
  779.  
  780.  
  781. // ============================================================================
  782. // EXPLANATION : MISSION GOAL
  783. // ============================================================================
  784.  
  785. [STATE Explain_mission_goal]
  786.     FirstTutorialTextID        = 254
  787.     LastTutorialTextID        = 255
  788.     ReturnState        = 'End'
  789.     SetState("Show_tutorial_text_serie")
  790.  
  791.  
  792.  
  793. // ============================================================================
  794. // EXPLANATION : VCOND DIALOG
  795. // ============================================================================
  796. [STATE Explain_vcond]
  797.     TutorialTextID    = 252
  798.     ReturnState        = 'Wait_for_vcond_open'
  799.     SetState("Show_tutorial_text")
  800.  
  801. [STATE Wait_for_vcond_open]
  802.     IF IsDialogOpen("UIF_missiongoal.uif") == 1
  803.     THEN
  804.         TutorialTextID    = 253
  805.         ReturnState        = 'Wait_for_vcond_close'
  806.         SetState("Show_tutorial_text")
  807.     END
  808.  
  809. [STATE Wait_for_vcond_close]    
  810.     IF IsDialogOpen("UIF_missiongoal.uif") == 0
  811.     THEN
  812.         TutorialTextID    = 254
  813.         ReturnState        = 'End'
  814.         SetState("Show_tutorial_text")
  815.     END
  816.  
  817. [STATE End]
  818.  
  819.     IF IsEnterState
  820.     THEN
  821.         StopCommandFiltering()
  822.     END
  823.  
  824.     // Otherwise do nothing ... 
  825.  
  826.  
  827.  
  828.  
  829. // ============================================================================
  830. // HELPER STATES
  831. // 
  832. // Here are some states, which are used to do repetitive tasks.
  833. // ============================================================================
  834. //-----------------------------------------------------------------------------
  835. // Show_tutorial_text
  836. // - Opens tutorial text
  837. // - Waits until it is closed
  838. // - Returns to the return state
  839. // ----------------------------------------------------------------------------
  840. [STATE Show_tutorial_text]
  841.  
  842.     IF IsEnterState
  843.     THEN
  844.         TutorialText.Show(TutorialTextID)
  845.     ELSE
  846.         IF TutorialText.IsOpen() == 0
  847.         THEN 
  848.             SetState(ReturnState)
  849.         END
  850.     END
  851.  
  852. //-----------------------------------------------------------------------------
  853. // Show_tutorial_text_serie
  854. // - Shows a serie of tutorial texts from FirstTutorialTextID to LastTutorialTextID
  855. // ----------------------------------------------------------------------------
  856. [STATE Show_tutorial_text_serie]
  857.  
  858.     IF IsEnterState
  859.     THEN
  860.         Local_i = FirstTutorialTextID
  861.         TutorialText.Show(FirstTutorialTextID)
  862.     ELSE
  863.         IF TutorialText.IsOpen() == 0
  864.         THEN 
  865.             Local_i = Local_i + 1
  866.             
  867.             IF Local_i > LastTutorialTextID
  868.             THEN
  869.                 SetState(ReturnState)
  870.             ELSE
  871.                 TutorialText.Show(Local_i)
  872.             END
  873.         END
  874.     END
  875.